home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16822 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: surfnet.nl!sun4nl!ittpub!ittpub!nntp
  2. Newsgroups: comp.lang.c++
  3. Subject: Re: Is this a memory leak?
  4. Message-ID: <1996Apr12.134122.1834@ittpub>
  5. From: wil@ittpub.nl (Wil Evers)
  6. Date: 12 Apr 96 13:41:22 WET
  7. References: <316ABE12.1915@delta.com>
  8. Distribution: world
  9. Nntp-Posting-Host: lintilla
  10.  
  11. In article <316ABE12.1915@delta.com> Sean Palmer <sean@delta.com> writes:
  12. > > Also, many prominent people involved in C++, among them Bjarne
  13. > > Stroustrup, the language's designer, recommend using 0, not NULL, 
  14. > > as a null pointer. One of the arguments against NULL is that it is not
  15. > > as portable as 0; some people might spell it 'Null', or 'null'.
  16. > Sounds like an argument against case sensitivity to me....
  17.  
  18. The real reason C++ programmers prefer plain `0' over `NULL' is that some  
  19. C header files define `NULL' as `(void *) 0'. In C, it is legal to assign  
  20. a void * to any other pointer type, while in C++ that requires a cast.  
  21. However, in both languages, it is legal to assign the integer constant `0'  
  22. (or even `1 - 1') to any pointer.
  23.  
  24. - Wil
  25.   
  26.